package com.bp.hearthealth.pulse.lnapps.bp_ui.bp_activity.feedback

import android.text.TextUtils
import android.view.View
import com.bp.hearthealth.pulse.lnapps.R
import com.bp.hearthealth.pulse.lnapps.base.BpBaseActivity
import com.bp.hearthealth.pulse.lnapps.bp_extension.UIHelperBp
import com.bp.hearthealth.pulse.lnapps.bp_utils.DoubleClickListener
import com.bp.hearthealth.pulse.lnapps.databinding.ActivityFeedBackBinding
import com.gyf.immersionbar.ImmersionBar
import com.hjq.toast.Toaster
import java.util.Timer
import java.util.TimerTask

class FeedBackActivity : BpBaseActivity<ActivityFeedBackBinding>() {
    override fun initData() {
        super.initData()
        binding.tvSubmit.setOnClickListener(object : DoubleClickListener() {
            override fun onNoDoubleClick(v: View?) {
                if (TextUtils.isEmpty(binding.edProblem.getText()) || TextUtils.isEmpty(binding.edEmail.getText())) {
                    Toaster.show(getString(R.string._send_stop_str))
                    return
                }
                Toaster.show(getString(R.string._send_sucess_str))
                Timer().schedule(object : TimerTask(){
                    override fun run() {
                        finish()
                    }
                },500)
            }
        })
    }

    override fun initImmersionBar() {
        super.initImmersionBar()
        binding.includeFeedback.tvBack.text = UIHelperBp.getString(R.string._feedback_str)
        binding.includeFeedback.toolbar.setOnClickListener { finish() }
        ImmersionBar.with(this).statusBarDarkFont(true).titleBar(binding.includeFeedback.toolbar)
            .init()
    }
}